function J = getjac(s)

  nd = size(s.d);
  ld = length(nd);
  d = permute(s.d,[2:ld 1]);
  if(ld > 2 && nd(2)==1)
    J = reshape(d,[nd(1) nd(3:end)]);
  else
    J = squeeze(d);
  end

